package com.wzs.rpc.server;

import io.vertx.core.Vertx;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class VertxHttpServer implements HttpServer {
    @Override
    public void doStart(int port) {
        Vertx vertx = Vertx.vertx();

        vertx.createHttpServer()
                .requestHandler(new HttpServerHandler())
                .listen(port)
                .onSuccess(server -> {
                    log.info("HTTP server started on port {}", server.actualPort());
                })
                .onFailure(Throwable::printStackTrace);
    }
}
